Skip to content

[v4.6] Fix shipment adjustments not persisting on order recalculate#6336

Merged
tvdeyen merged 1 commit intov4.6from
backport/v4.6/pr-6334
Oct 21, 2025
Merged

[v4.6] Fix shipment adjustments not persisting on order recalculate#6336
tvdeyen merged 1 commit intov4.6from
backport/v4.6/pr-6334

Conversation

@github-actions
Copy link

Backport

This will backport the following commits from main to v4.6:

Questions ?

Please refer to the Backport tool documentation

@github-actions github-actions bot requested a review from a team as a code owner October 21, 2025 07:53
@github-actions github-actions bot added the changelog:solidus_core Changes to the solidus_core gem label Oct 21, 2025
A commit was made in #6315 (5979f25) in service of the in memory order updater #5872 that changed the behavior in the OrderTaxation class to set the adjustment value but not persist it. Instead, the persistence happens when the order is saved. If a shipment is changed, and an associated adjustment is changed, the shipment adjustment will be autosaved when the order is.

However, if a shipment is *not* changed, but the adjustment is, the adjustment will *not* be autosaved when the order is.

In #6315, we ensured that these changed associations cannot get left behind by setting `autosave: true`, which forces the model to check if it has any associations that need saving instead of telling it's relation "nope I haven't changed"

We can do the same thing here for the shipment to ensure changing  adjustments will make the shipment tell it's order "I have changed", even if none of it's direct properties have changed.

You can test this change by removing the `autosave: true` option the adjustments and running 'when the address has changed to a different state' specs. They fail with the error "expected `order.shipments.first.adjustments.first.amount` to have changed from 1 to 2, but did not change", demonstrating a scenario where the shipment adjustment changes do not get persisted.

(cherry picked from commit b47e0f0)
@tvdeyen tvdeyen force-pushed the backport/v4.6/pr-6334 branch from cbac5b8 to 9dbe270 Compare October 21, 2025 08:38
@tvdeyen
Copy link
Member

tvdeyen commented Oct 21, 2025

Force pushed with my commiter ID to trigger workflow runs. This will hopefully be fixed by #6337

@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (v4.6@d383ba4). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             v4.6    #6336   +/-   ##
=======================================
  Coverage        ?   89.35%           
=======================================
  Files           ?      961           
  Lines           ?    20195           
  Branches        ?        0           
=======================================
  Hits            ?    18046           
  Misses          ?     2149           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tvdeyen tvdeyen merged commit bb880b7 into v4.6 Oct 21, 2025
37 checks passed
@tvdeyen tvdeyen deleted the backport/v4.6/pr-6334 branch October 21, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:solidus_core Changes to the solidus_core gem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants